import Skype4Py

#import logging
#logging.basicConfig(level=logging.DEBUG)

class SkypeWinComponent:
    
    def draw(self):
        pass

class UserStatusPanel(SkypeWinComponent):
    pass

class ContactsListPanel(SkypeWinComponent):
    pass

class ChatPanel(SkypeWinComponent):
    pass

class MessageInputPanel(SkypeWinComponent):
    pass

class ParticipantsPanel(SkypeWinComponent):
    pass

class ConsoleSkype(Skype4Py.Skype):
    
    def __init__(self):
        super(ConsoleSkype, self).__init__()
        
        self.OnAttachmentStatus = self.on_attach
        self.OnMessageStatus = self.on_msg
        
        self.panels = []
        
        self.contacts_panel = ContactsListPanel()
        self.chat_panel = ChatPanel()
        self.msg_input_panel = MessageInputPanel()
        self.status_panel = UserStatusPanel()
        self.participants_panel = ParticipantsPanel()
        
        self.panels.append(self.contacts_panel)
        self.panels.append(self.chat_panel)
        self.panels.append(self.msg_input_panel)
        self.panels.append(self.status_panel)
        self.panels.append(self.participants_panel)
        
    def on_attach(self, status):
        print 'API attachment status: ' + self.Convert.AttachmentStatusToText(status)
        if status == Skype4Py.apiAttachAvailable:
            self.Attach()

        if status == Skype4Py.apiAttachSuccess:
            print('******************************************************************************')

    # ----------------------------------------------------------------------------------------------------
    # Fired on chat message status change. 
    # Statuses can be: 'UNKNOWN' 'SENDING' 'SENT' 'RECEIVED' 'READ'        

    def on_msg(self, Message, Status):
        if Status == 'RECEIVED':
            print(Message.FromDisplayName + ': ' + Message.Body)
        if Status == 'SENT':
            print('Myself: ' + Message.Body);
        if Status == 'SENDING':
            pass
        if Status == 'SENT':
            pass
        if Status == 'RECEIVED':
            pass
        
    def connect(self):
        self.Attach()
        
    def say_hello(self):
        print('hello')
        
    def draw(self):
        for panel in self.panels:
            panel.draw()

cskype = ConsoleSkype()
cskype.say_hello()
cskype.connect()

cmd = ''
while not cmd == 'exit':
    cskype.draw()
    cmd = raw_input('')